/**
 * 
 */
package com.doone.telmarket.infrastructure.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.doone.telmarket.domain.Comment;
import com.doone.telmarket.infrastructure.dao.BaseDaoSupport;
import com.doone.telmarket.infrastructure.dao.CommentDAO;
import com.doone.telmarket.vo.CommentView;

/**
 * @author 吴同庆
 * @date 2009-10-13
 * @description 用户评论DAO接口实现
 * @package com.doone.telmarket.infrastructure.dao.impl
 */

@Repository("commentDAO")
public class CommentDAOImpl extends BaseDaoSupport implements CommentDAO {

	/**
	 * 根据业务代码查询评论
	 */
	@SuppressWarnings("unchecked")
	public List<Comment> selectCommentByServiceCode(CommentView view) {
		return getSqlMapClientTemplate().queryForList("Comment.selectCommentByServiceCode", view);
	}

	/**
	 * 插入评论
	 */
	public Integer insertComment(Comment comment) {
		Integer key = (Integer) getSqlMapClientTemplate().insert("Comment.insertComment", comment);
		return key;
	}

	/**
	 * 更新评论评审状态和时间
	 */
	public Integer updateCommentByVerifyStateAndTime(Comment comment) {
		Integer key = getSqlMapClientTemplate().update("Comment.updateCommentByVerifyStateAndTime", comment);
		return key;
	}

	/**
	 * 根据主键查询评论
	 */
	public Comment selectCommentByPrimaryKey(Integer key) {
		Comment comment = (Comment) getSqlMapClientTemplate().queryForObject("Comment.selectCommentByPrimaryKey", key);
		return comment;
	}
}
